#include "comm.hpp"
#include <unistd.h>
int main()
{
    key_t key = GetKey();
    int shmid = GetShm(key);
    char* s = (char*)shmat(shmid, nullptr, 0);
    std::cout << "attach shm done" << std::endl;
    char input = 'a';
    int fd = open(filename.c_str(), O_WRONLY);
    for(; input <= 'z'; input ++)
    {
        s[input - 'a'] = input;
        int code = 1;
        write(fd, &code, sizeof(int));
        sleep(1);
    }
    close(fd);
    shmdt(s);
    std::cout << "Detack shm done" << std::endl;
    return 0;
}